/**
 * desc: tab
 * author: Joe
 * date: 7/30/2018
 */

coreModule.component('nTab', {
  transclude: true,
  templateUrl: 'components/tab/tab.template.html',
  controller: function() {
    var panes = this.panes = [];

    this.select = function(pane) {
      angular.forEach(panes, function(p) {
        p.selected = false;
      });
      pane.selected = true;
    };

    this.addPane = function(pane) {
      if (panes.length === 0) {
        this.select(pane);
      }
      panes.push(pane);
    };
  },
});
